﻿using System.Collections.Generic;
using GameFramework.common;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;

namespace GameFramework.skill
{
    [CreateAssetMenu(fileName = "SkillConfigManager", menuName = "configs/SkillConfigManager")]
    public class SkillConfigManager:ScriptableObjectSingleton<SkillConfigManager>
    {
        private  Dictionary<int, SkillConfig> skillConfigs = new Dictionary<int, SkillConfig>();

        public  List<SkillConfig> configs = new List<SkillConfig>();
        
        public SkillConfig getConfig(int id)
        {
            if (skillConfigs.Count > 0)
            {
                return skillConfigs[id];
            }

            return null;
        }

        protected override void  init()
        {
            //TODO 代码生成，加入容器
            // configs.Add();
            if (skillConfigs.Count == 0 && configs.Count > 0)
            {
                foreach (SkillConfig config in configs)
                {
                    skillConfigs.Add(config.id,config);
                }
            }
        }
    }
}